package nccu.dao.hibernate;

import nccu.dao.CycleDao;
import nccu.model.Cycle;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * This class interacts with Spring's HibernateTemplate to save/delete and
 * retrieve Cycle objects.
 *
 * @author <a href="mailto:chris.oberle@gmail.com">Chris Oberle</a>
*/
@Repository("cycleDao")
public class CycleDaoHibernate extends GenericDaoHibernate<Cycle, Long> implements CycleDao {

    public CycleDaoHibernate() {
        super(Cycle.class);
    }

    public List<Cycle> findByName(String name){
        return getHibernateTemplate().find("from Cycle where name=?", name);
    }
}
